import request from '../util/request'
import {KEY,API_24,API_7D,API_GEO_CITY,API_NOW,API_AIR,API_INDICES,API_INDICES3D} from './urlAPI';
//未来24小时天气预报请求

const fetch24HourData = (locationID)=> {
    return request.get(API_24,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}

//未来7日天气预报请求

const fetch7DayData = (locationID) =>{
    return request.get(API_7D,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}

export {fetch24HourData,fetch7DayData}
export const fetchCityData = (cityname) => {
    return request.get(API_GEO_CITY, {
        params: {
            location: cityname,
            key: KEY,
        }
    })
    
}

export const fetchNowData = (locationID) => {
    return request.get(API_NOW,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}

export const fetchAirData = (locationID) => {
    return request.get(API_AIR,{
        params:{
            location: locationID,
            key: KEY,
        }
    })
}

export const fetchIndicesData = (locationID,type) => {
    return request.get(API_INDICES,{
        params:{
            location: locationID,
            type: type,
            key: KEY,
        }
    })
}

export const fetchIndices3Data = (locationID,type) => {
    return request.get(API_INDICES3D,{
        params:{
            location: locationID,
            type: type || 1, 
            key: KEY,
        }
    })
}